home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / XLisp-Stat / Functions / showcoord.lsp < prev    next >
Text File  |  1990-10-11  |  985b  |  30 lines

  1. ; book pp.274-275
  2.  
  3. (send graph-proto :add-mouse-mode 'show-coordinates
  4.     :title "Show Coordinates"
  5.     :click :do-show-coordinates
  6.     :cursor 'finger)
  7.  
  8. #| canvas coordinates
  9. (defmeth graph-proto :do-show-coordinates (x y n1 n2)
  10.   (let ((s (format nil "~s" (list x y)))
  11.         (mode (send self :draw-mode)))
  12.      (send self :draw-mode 'xor)
  13.      (send self :draw-string s x y)
  14.      (send self :while-button-down #'(lambda (x y) nil))
  15.      (send self :draw-string s x y)
  16.      (send self :draw-mode mode)))
  17. |#
  18.  
  19. (defmeth graph-proto :do-show-coordinates (x y m1 m2)
  20.   (let* ((xy (cond (m1 (send self :canvas-to-real x y))
  21.                    (m2 (send self :canvas-to-scaled x y))
  22.                    (t (list x y))))
  23.         (s (format nil "~s" xy))
  24.         (mode (send self :draw-mode)))
  25.      (send self :draw-mode 'xor)
  26.      (send self :draw-string s x y)
  27.      (send self :while-button-down #'(lambda (x y) nil))
  28.      (send self :draw-string s x y)
  29.      (send self :draw-mode mode)))
  30.